<?php require_once('dao/configuration.php');

$result = mysql_query("SELECT * FROM time_attendance WHERE id = '".$_GET['id']."' AND date = '".$_GET['date']."'") or die(mysql_error());

$record = mysql_fetch_assoc($result);


//

/*
<script type="text/javascript" src="../js/jquery.validate.js"></script>	
<link rel="stylesheet" href="../css/redmond/jquery-ui-1.8.16.custom.css" type="text/css" media="all" />
 */
?>



<link href="../css/core.css" type="text/css" rel="stylesheet"/>
<link href="../css/redmond/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" media="all" />
<script src="../js/jquery-1.6.2.min.js" type="text/javascript"></script>
<script src="../js/jquery-ui-1.8.16.js" type="text/javascript"></script>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<title></title>
<style>
	    .ui-button { margin-left: -1px; }     
	    .ui-button-icon-only .ui-button-text { padding: 0.35em; }      
	    .ui-autocomplete-input { margin: 0; padding: 0.48em 0 0.47em 0.45em; }
	    * { font-family: Verdana; font-size: 96%; }
		label { width: 10em; float: left; }
		label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
		p { clear: both; }
		.submit { margin-left: 12em; }
		em { font-weight: bold; padding-right: 1em; vertical-align: top; }
	</style>
	<script>
	$(function() {
		var availableTags = [
			"Arrange Delivery",
			"Bank Charge",
			"Counter Pickup",
			"Goods Receipt",
			"Goods Return",
			"Late Batch",
			"Month End/Default",
			"Packing",
			"Prepare Report",
			"Scanning Form",
			"Send SMS"
		];
		var $input = $("#remarks").autocomplete({
			source: availableTags,
			minLength: 0
		});

		$("<button type='button'>&nbsp;</button>")                     
	    .attr("tabIndex", -1)                     
	    .attr("title", "Show All Items")                     
	    .insertAfter($input)                     
	    .button({                         
	        icons: {                             
	            primary: "ui-icon-triangle-1-s"                         
	        },                         
	        text: false                     
	    })                     
	    .removeClass("ui-corner-all")                     
	    .addClass("ui-corner-right ui-button-icon")                   
	    .click(function() {                         
	        // close if already visible                         
	        if ($input.autocomplete("widget").is(":visible")) {                        
		         $input.autocomplete( "close" );
	             return;                         
	        }                                              
	        $(this).blur();                                                 
	        $input.autocomplete("search", "" );                         
	        $input.focus();                     
	   
			
	});

	$("#updateStaffRecordForm").validate({
		rules: {
			work_start_time: {
				required : true
			},
			start_time: {
				digits : true,
				minlength:4
			},
			end_time: {
				digits : true,
				minlength:4
			},
			break_start: {
				digits : true,
				minlength:4
			},
			break_end: {
				digits : true,
				minlength:4
			}
		}
	});	
});

	              
</script>

<body style="background:#FFF">
	<fieldset>
		<div class="title">Update Record</div>
					<form id="updateStaffRecordForm"  method="post" action="taController.php?request=update-record&return=<?php echo $domain; ?>/viewrecords.php" enctype="multipart/form-data">
				    	<p><label for="date">Date:</label>
				        <input name="date" id="date" type="text" value="<?php echo $_GET['date'];?>" readonly="readonly"/></p>
				        
				        <p><label for="work_start_time">Official:</label>
				        <input name="work_start_time" id="work_start_time" type="text" value="<?php echo $record['work_start_time'];?>"/></p>
				        
				        <p><label for="start_time">Start Time:</label>
				        <input name="start_time" id="start_time" type="text" value="<?php echo $record['start_time'];?>" <?php if($record['start_time'] != "") echo "readonly='readonly'";?>/></p>
				        
				        <p><label for="end_time">End Time:</label>
				        <input name="end_time" id="end_time" type="text" value="<?php echo $record['end_time'];?>" <?php if($record['end_time'] != "") echo "readonly='readonly'";?>/></p>
				        
				        <p><label for="break_start">Break Start:</label>
				        <input name="break_start" id="break_start" type="text" value="<?php echo $record['break_start'];?>" <?php if($record['break_start'] != "") echo "readonly='readonly'" ;?>/></p>
				        
				        <p><label for="break_end">Break End:</label>
				        <input name="break_end" id="break_end" type="text" value="<?php echo $record['break_end'];?>" <?php if($record['break_end'] != "") echo "readonly='readonly'";?>/></p>
				        
				        <p><label for="day">Day:</label>
				        <select name="day" style="width: 155px">
				        	<option value="NORMAL">NORMAL</option>
				        	<option value="OFF" <?php if($record['day'] == "OFF") echo "SELECTED"?>>OFF</option>
				        	<option value="HALF DAY" <?php if($record['day'] == "HALF DAY") echo "SELECTED"?>>HALF DAY</option>
						</select></p>
						<p><label>Remarks :</label>
						<div class="ui-widget">
				        <input id="remarks" type="text" name="remarks" value="<?php echo $record['remarks'];?>"/>
				        </div></p>
				        
				        <p><input name="send" class="formbutton" value="Update" type="submit" /></p>
				        <input type="hidden" name="id" value="<?php echo $record['id'];?>"></input>
				    </form>
	</fieldset>
                            
                           

</body>
</html>